package edu.wit.common.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement
@Component
public class MybatisPlusConfig {
    /**
     * 分页查询插件
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //当请求的页数大于最大页跳回到首页
        paginationInterceptor.setOverflow(true);
        return paginationInterceptor;
    }
}
